package com.lenin.omena.client.event;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.lenin.omena.shared.LoginResult;
import com.lenin.omena.shared.SaveProduceResult;
import com.lenin.omena.shared.domain.Site;

public class SaveProduceEvent extends GwtEvent<SaveProduceEventHandler> {

	public static Type<SaveProduceEventHandler> TYPE = new Type<SaveProduceEventHandler>();

	public static HandlerRegistration register(final EventBus eventBus,
			final SaveProduceEventHandler handler) {

		return eventBus.addHandler(SaveProduceEvent.TYPE, handler);

	}

	private SaveProduceResult result;

	public SaveProduceEvent(SaveProduceResult result) {
		this.result = result;
	}

	public SaveProduceResult getResult() {
		return result;
	}

	@Override
	public Type<SaveProduceEventHandler> getAssociatedType() {
		return SaveProduceEvent.TYPE;
	}

	@Override
	protected void dispatch(final SaveProduceEventHandler handler) {
		handler.onSaveProduce(this);
	}

}